home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / paspeak.zip / SPEAK.PAS < prev    next >
Pascal/Delphi Source File  |  1985-01-02  |  2KB  |  58 lines

  1.  
  2.  
  3. Procedure Call_Speech ( var input : str ); EXTERNAL 'turbolip.com';
  4.  
  5.             { Turbolip.com interfaces pascal to the *MODIFIED*
  6.                t-speech.com module via the 'Call_Speech' procedure }
  7.  
  8.  
  9. Procedure Speak ( Script : str );
  10.  
  11.             { 'Speak' checks to see if a speech module is installed.
  12.               It doesn't differentiate between the BASIC and
  13.               Pascal versions.  If installed, the module is called,
  14.               otherwise an error message is printed and the program is halted.
  15.               'Call_Speech' can be called directly but only with a text
  16.               variable as its argument. You can expect an
  17.               *insta-crash* if there's no speech module installed.  }
  18.  
  19.  
  20.  const
  21.   F2_vector  = $03C6;  { int $f2 calls the speech program.  $0000:$03C6
  22.                          contains the cs pointer for t-speech.com and int f2 }
  23.  
  24.   Speech_ofs = $0100;  { com files begin execution at offset $0100 }
  25.  
  26.  var
  27.   Byte1,                      {  Byte1-3 pick up the first three bytes }
  28.   Byte2,                      {  of the cs:0100H to see if they match  }
  29.   Byte3,                      {  those of the speech module            }
  30.   Speech_Code :  Integer;
  31.  
  32. Begin
  33.   Speech_Code := Memw [ $0000 : F2_vector ];      { get cs of t-speech.com  }
  34.  
  35.   Byte1 := Mem [ Speech_Code : Speech_Ofs   ];    { get first three bytes of }
  36.   Byte2 := Mem [ Speech_Code : Speech_Ofs+1 ];    { t-speech.com               }
  37.   Byte3 := Mem [ Speech_Code : Speech_Ofs+2 ];
  38.  
  39. If  ( Byte1  = $90 ) and ( Byte2 = $1E ) and ( Byte3 = $B8 )
  40.  
  41.              { if bytes match the reference bytes then }
  42.              { assume that t-speech.com is installed     }
  43.  
  44.  
  45.      Then Call_Speech ( Script )
  46.  
  47.        Else Begin                    { t-speech.com not installed }
  48.  
  49.              Write ( #7,#7,#7 );
  50.              Writeln ( 'Speech module not installed!!' );
  51.              Writeln ( 'System crash narrowly averted (Whew!).' );
  52.              Halt;   { aren't you relieved?! }
  53.  
  54.            End;
  55.  
  56. End;
  57.  
  58.